CyberMinds Logo

Course 5 - Encryption with Python

Programming Problem 1: Substitution Cipher

Objective

Implement a Python program to perform Substitution Cipher encryption.

Hints

  1. Create a function substitution_cipher_encrypt(plaintext, key) with parameters for the plaintext and a substitution key.
  2. The substitution key should be a dictionary mapping each letter to its replacement.
  3. Handle both uppercase and lowercase letters while preserving spaces and non-alphabetic characters.
  4. Iterate through each letter in the plaintext and replace it according to the substitution key.

Terminal

Run

Programming Problem 2: Caesar Cipher Encryption

Background

You are given a plaintext message containing only uppercase English letters. Your task is to encrypt the message using a Caesar Cipher. The Caesar Cipher is a substitution cipher where each letter in the plaintext is shifted a certain number of places down or up the alphabet.

Objective

Write a Python function called caesar_cipher_encrypt that takes two parameters: the plaintext message and the shift value. The function should return the encrypted message.

Hints

  1. Ensure that the function handles only uppercase letters. Ignore spaces and other characters.
  2. Use the ASCII values of characters to perform the shift.
  3. Use the modulo operator to handle wrapping around the alphabet.

Terminal

Run

Feel free to test this solution with different plaintext and shift values.